//
//  WXShowDetailTableViewCell.m
//  CarJX
//
//  Created by xcq on 14-10-17.
//  Copyright (c) 2014年 KK. All rights reserved.
//

#import "WXShowDetailTableViewCell.h"


#define kUp @"直行"
#define kDown @"下"
#define kLeft @"左"
#define kRight @"右"
#define kFinish @"终点"
@implementation WXShowDetailTableViewCell

- (void)awakeFromNib
{
    _dic = [NSDictionary dictionaryWithObjects:@[kUp,kDown,kLeft,kRight,kFinish] forKeys:@[@"1",@"2",@"3",@"4",@"5"]];
}

- (void) setDetailWithPhoto:(NSString *)detail{
    
    detail = [detail stringByReplacingOccurrencesOfString:@"<b>" withString:@""];
    detail = [detail stringByReplacingOccurrencesOfString:@"</b>" withString:@""];
    detail = [detail stringByReplacingOccurrencesOfString:@"<font color=\"0x000000\">" withString:@""];
    detail = [detail stringByReplacingOccurrencesOfString:@"</font>" withString:@""];
    
    
    _addressDetail.text = detail;
  //  [self rangeOfString:detail];
    
    
}
-(NSString *) rangeOfString:(NSString *) astring{
//将rangeOfString:发送给一个NSString对象时，传递的参数时要查找的字符串。它会返回一个NSRange struct来告诉你一个与这个字符串相匹配的部分从哪里开始以及匹配上的字符个数。
    
    for (int i = 0; i < 5;  i ++ ) {
        
        NSString *temp = [_dic objectForKey:[NSString stringWithFormat:@"%d",i]];
        NSRange range=[astring rangeOfString:temp];
        
        
        
        if(range.location!=NSNotFound){
            
            return temp;
            
        }else{
            return @"";
        }
        
    }
    return nil;
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
